<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.io.*"%>
<%@ page import="edu.ntu.im.p2ptrade.OwnerManager"%>

<html>
<title>user_profile</title>
<link href="../css/css.css" rel="stylesheet" type="text/css">
<body>
<form method="post">
<div align="center"><jsp:include page="/top.tpl" />

  <p>
    <%
	String name = "";
	String password = "";
	String nickname = "";
	String photoURL = "";
	String buttonName = "add";
	if(OwnerManager.getOwner()!=null)
	{
		name = OwnerManager.getOwner().getName();
		password = OwnerManager.getOwner().getPassword();
		nickname = OwnerManager.getOwner().getNickName();
		photoURL = OwnerManager.getOwner().getPhotoURL();
		buttonName = "update";
	}
%>
    
  </p>
  <table width="500" border="0" cellpadding="2" cellspacing="2">
	<tr>
		<td colspan="3" align="center" class="header">My Profile</td>
	</tr>
	<tr>
		<td class="content_font" style="padding:5px;"> user name:</td>
		<td colspan="2" style="padding:5px;"><input name="user_name" type="text" class="text_font" value="<%=name%>"></td>
	</tr>
	<!-- <tr>
		<td class="content_font" style="padding:5px;"> password:</td>
		<td colspan="2" style="padding:5px;"><input type="password" name="password" value="<%=password%>"></td>
	</tr> -->
	<tr>
		<td class="content_font" style="padding:5px;">nickname:</td>
		<td colspan="2" style="padding:5px;"><input name="nickname" type="text" class="text_font" value="<%=nickname%>"></td>
	</tr>
	<tr>
		<td rowspan="2" class="content_font" style="padding:5px;">my photo:</td>
		<%
			if(!"".equals(photoURL))
				out.println("<td><img src=\"http://"+photoURL+"\" border=\"0\" height=\"50\" width=\"50\"></td>");
		%>
		<td style="padding:5px;">http://<input name="photoURL" type="text" class="text_font" value="<%=photoURL%>"></td>
	</tr>
</table>

<div align="center"><input name="sned" type="button" class="text_font"
	onClick="document.forms[0].action = '/p2ptrade/user/addOrUpdateUser.do';document.forms[0].submit();" value="<%=buttonName %>">
</div>
</div>
</form>
</body>
</html>